<%--
  Created by IntelliJ IDEA.
  权限列表页面
  User: hejx
  Date: 2017/5/22
  Time: 9:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    double rand = Math.random();
%>
<html>
<head>
    <!--头部-->
    <title>权限列表</title>

    <link rel="stylesheet" href="<%=basePath%>static/css/plugins/bootstrap-table/bootstrap-table.min.css">
    <jsp:include page="/template/header.jsp" />
    <!--头部结束-->
</head>
<body class="gray-bg">
    <div class="container" style="width: 100%">
        <div id="toolbar" class="btn-group">
             <button id="btn_add" type="button" class="btn btn-primary" onclick="openAddWin();">
             <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
             </button>
             <button id="btn_edit" type="button" class="btn btn-primary" onclick="openUpdateWin();">
             <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
             </button>
             <button id="btn_delete" type="button" class="btn btn-primary">
             <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
             </button>
        </div>
        <div id="tableDiv" style="overflow-y:auto;overflow-x:auto;">
            <table id="demo-table" >
            </table>
        </div>
    </div>
    <jsp:include page="/template/list_tail.jsp" />
    <script src="<%=basePath%>static/plugins/angular/angular.min.js"></script>
    <script src="<%=basePath%>static/plugins/angular/app.js"></script>
    <script src="<%=basePath%>static/js/roleList.js?rand=<%=rand%>"></script>
</body>

    <script>

        //关闭iframe窗口
        function closeWin(){
            layer.closeAll('iframe'); //关闭所有的iframe层
        }

        //关闭iframe窗口刷新列表
        function closeWinAndFlush(){
            closeWin();
            $('#demo-table').bootstrapTable('refresh');    //刷新表格
        }

        //打开新增数据窗口
        function openAddWin(){
            openInputWin('/admin/role/openInputPageForAdd','新增角色');
        }

        //打开修改数据窗口
        function openUpdateWin(){
            var row = $.map($("#demo-table").bootstrapTable('getSelections'),function(row){
                return row.pkId ;
            });//只得到其中的ID
            if(row.length==0){
                layer.msg("请选择需要修改的数据");
                return false;
            }
            if(row.length>1){
                layer.msg("只能选中一条数据进行修改");
                return false;
            }
            openInputWin('/admin/role/openInputPageForUpdate?id='+row[0],'修改角色');
        }

    </script>

</html>
